.TH CHMOD 1 
.SH NAME
chmod \- change mode
.SH SYNOPSIS
.B chmod
mode file ...
.SH DESCRIPTION
The mode of
each named file
is changed
according to
.I mode,
which may be absolute or symbolic.
An absolute
.I mode
is an octal
number constructed
from the OR of the
following modes:
.TP 10
4000
set user ID on execution
.br
.br
.ns
.TP 10
2000
set group ID on execution
.br
.br
.ns
.TP 10
1000
sticky bit, see
.IR  chmod (2)
.br
.br
.ns
.TP 10
0400
read by owner
.br
.br
.ns
.TP 10
0200
write by owner
.br
.br
.ns
.TP 10
0100
execute (search in directory) by owner
.br
.br
.ns
.TP 10
0070
read, write, execute (search) by group
.br
.br
.ns
.TP 10
0007
read, write, execute (search) by others
.PP
A symbolic
.I mode
has the form:
.IP
.RI [ who ]
.I op permission
.RI [ "op permission" "] ..."
.PP
The
.I who
part is a combination
of the letters 
.B u
(for user's permissions),
.B g
(group)
and
.B o
(other).
The letter
.B a
stands for
.B ugo.
If
.I who
is omitted,
the default is
.I a
but the setting of
the file creation mask
(see umask(2))
is taken into account.
.PP
.I Op
can be
.B +
to add
.I permission
to the file's mode,
.B \-
to take away
.I permission
and
.B =
to assign
.I permission
absolutely
(all other bits will
be reset).
.PP
.I Permission
is any combination of the letters
.B r
(read),
.B w
(write),
.B x
(execute),
.B s
(set owner or group id)
and
.B t
(save text \- sticky).
Letters
.BR u,
.B g
or
.B o
indicate that
.I permission
is to be taken
from the current
mode.
Omitting
.I permission
is only useful
with
.B =
to take away
all permissions.
.PP
The first example denies write permission to others,
the second makes a file executable:
.IP
chmod o\-w file
.br
chmod +x file
.PP
Multiple symbolic modes separated by commas may be given.
Operations are performed
in the order specified.
The letter
.B s
is only useful
with
.B u
or
.B g.
.PP
Only the owner of a file (or the super-user) may change its mode.
.SH "SEE ALSO"
ls(1),
chmod(2),
chown (1),
stat(2),
umask(2)
